package api;

/**
 * 多线程例子
 * https://kylepeng93.github.io
 *
 * @author pengkai
 * @date 2021-03-23 下午10:37
 */
public class MultipleThreadDemmo implements Runnable {

    static long total = 0L;

    public static void main(String[] args) {
        new Thread(new MultipleThreadDemmo(), "计算器进程").start();
        System.out.println("正在计算...");
    }

    @Override
    public void run() {
        for(int i = 0; i < 10000; i++) {
            total += i;
        }
        System.out.println(Thread.currentThread().getName());
        System.out.println("计算结果是" + total);
    }
}
